package com.itheima.zuoye.zy1;

public class Test {
        public static void main(String[] args) {
            int day =1;
            int peaches = getPeach(day);
            System.out.println("猴子第一天摘了 " + peaches + " 个桃子。");
        }

        public static int getPeach(int day) {
            if (day == 10) {
                return 1; // 第10天剩1个
            } else {
                return 2 * (getPeach(day + 1) + 1); // 递归公式
            }
        }
    }




